import httpRequest from '../../utils/studioRequest'
// debug转换
export function debug (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/debug'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 查看数据库连接
export function explore (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/explore'),
    method: 'get',
    params: httpRequest.adornParams(params)
  })
}
// 分析转换对数据库的影响
export function impact (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/impact'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 获取转换文件
export function ktr (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/ktr'),
    method: 'post',
    data: params
  })
}
// 停止转换
export function pause (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/pause'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 恢复暂停转换
export function resume (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/resume'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 预览转换
export function preview (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/preview'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 重放转换
export function replay (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/replay'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 获取转换执行日志、状态及结果
export function executeResult (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/result'),
    method: 'get',
    params: httpRequest.adornParams(params, 'get')
  })
}
// 执行转换
export function run (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/run'),
    method: 'post',
    data: params
  })
}
// 保存转换
export function save (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/save'),
    method: 'post',
    data: params
  })
}
// 保存转换
export function flinkSave (params) {
  return httpRequest({
    url: httpRequest.adornFlinkUrl('/flink/taskInfo/addAndUpdate'),
    method: 'post',
    data: params
  })
}
// 显示执行结果面板
export function show (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/show'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 获取运行转换需要的SQL
export function sql (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/sql'),
    method: 'get',
    params: httpRequest.adornParams(params)
  })
}
// 停止转换
export function stop (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/stop'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 校验转换
export function verify (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/verify'),
    method: 'post',
    params: httpRequest.adornParams(params)
  })
}
// 测试
export function test (params) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/test'),
    method: 'get',
    params: httpRequest.adornParams(params)
  })
}
// 获取字段
export function inputFields (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/input-fields'),
    method: 'POST',
    data: params,
    params: stepName
  })
}

// 获取字段
export function flinkInputFields (params, stepName) {
  return httpRequest({
    url: httpRequest.adornFlinkUrl('/component/getFieldsInfo'),
    method: 'POST',
    data: params
  })
}

// 获取后续步骤
export function nextsteps (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/next-steps'),
    method: 'POST',
    data: params,
    params: stepName
  })
}

// 获取前续步骤
export function previoussteps (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/previous-steps'),
    // url: httpRequest.adornFlinkUrl('/component/getStepNames'),
    method: 'POST',
    data: params,
    params: stepName
  })
}
export function flinkPrevioussteps (params, stepName) {
  return httpRequest({
    // url: httpRequest.adornUrl('/trans/previous-steps'),
    url: httpRequest.adornFlinkUrl('/component/getStepNames'),
    method: 'POST',
    data: params,
    // params: stepName
  })
}
// 获取输出字段
export function outPutFields (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/output-fields'),
    method: 'POST',
    data: params,
    params: stepName
  })
}
// 获取java左侧树list
// export function getJavaList () {
//   return httpRequest({
//     url: httpRequest.adornUrl('/trans/getJavaList'),
//     method: 'GET'
//   })
// }
// // 获取字段
// export function csvInputFields (params, stepName) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/DataValidator/get-fields'),
//     method: 'POST',
//     data: params,
//     params: stepName
//   })
// }
// 获取字段
export function hdfsInputFields (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/hadoop-file/get-hdfs-fields'),
    method: 'POST',
    data: params,
    params: stepName
  })
}
// // 获取标签页字段
// export function excelInputSheetFields (params, stepName) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/excel-input/get-sheets'),
//     method: 'POST',
//     data: params,
//     params: stepName
//   })
// }
//
// // 获取头部数据字段
// export function excelInputHeaderFields (params, stepName) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/excel-input/get-fields'),
//     method: 'POST',
//     data: params,
//     params: stepName
//   })
// }
// 预览数据
export function previewData (params, stepName) {
  return httpRequest({
    url: httpRequest.adornUrl('/trans/preview-data'),
    method: 'POST',
    data: params,
    params: stepName
  })
}
//
// // hbase获取指定表的映射
// export function getMappings (params) {
//   return httpRequest({
//     url: httpRequest.adornUrl(`/hbase/get-hbase-table-mapping`),
//     method: 'get',
//     params: httpRequest.adornParams(params, 'get')
//   })
// }
//
// // 保存映射
// export function saveMappings (params, theMapping) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/hbase/save-hbase-mapping'),
//     method: 'POST',
//     data: theMapping,
//     params: params
//   })
// }
//
// // 删除映射
// export function deleteMappings (params, stepName) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/hbase/delete-hbase-mapping'),
//     method: 'DELETE',
//     // data: params,
//     params: params
//   })
// }
//
// // 获取传入字段
// export function getIncomingFields (params, stepName) {
//   return httpRequest({
//     url: httpRequest.adornUrl('/hbase/get-mapping-template'),
//     method: 'POST',
//     data: params,
//     params: stepName
//   })
// }
